/*
	belcard-identification-tester.cpp
	Copyright (C) 2015  Belledonne Communications SARL

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "belcard/belcard.hpp"
#include "belcard-tester.hpp"

using namespace::std;
using namespace::belcard;

static void fn_property(void) {
	test_property<BelCardFullName>("FN:Sylvain Berfini\r\n");
	test_property<BelCardFullName>("FN:François Grisez\r\n");
}

static void n_property(void) {
	test_property<BelCardName>("N:Berfini;Sylvain;Pascal;;\r\n");
}

static void nickname_property(void) {
	test_property<BelCardNickname>("NICKNAME;TYPE=home:Viish\r\n");
}

static void bday_property(void) {
	test_property<BelCardBirthday>("BDAY:19891001\r\n");
	test_property<BelCardBirthday>("BDAY;VALUE=text:1er Octobre 1989\r\n");
}

static void anniversary_property(void) {
	test_property<BelCardAnniversary>("ANNIVERSARY;VALUE=date-and-or-time:20140621\r\n");
}

static void gender_property(void) {
	test_property<BelCardGender>("GENDER:M\r\n");
	test_property<BelCardGender>("GENDER:F;just kidding\r\n");
}

static void photo_property(void) {
	test_property<BelCardPhoto>("PHOTO;TYPE=work;VALUE=URL;MEDIATYPE=image/png:http://www.belledonne-communications.com/uploads/images/belledonne-communications.png\r\n");
	test_property<BelCardPhoto>("PHOTO:\r\n");
}

static test_t tests[] = {
	TEST_NO_TAG("Full name", fn_property),
	TEST_NO_TAG("Name", n_property),
	TEST_NO_TAG("Nickname", nickname_property),
	TEST_NO_TAG("Birthday", bday_property),
	TEST_NO_TAG("Anniversary", anniversary_property),
	TEST_NO_TAG("Gender", gender_property),
	TEST_NO_TAG("Photo", photo_property),
};

test_suite_t vcard_identification_properties_test_suite = {
	"Identification",
	NULL,
	NULL,
	NULL,
	NULL,
	sizeof(tests) / sizeof(tests[0]),
	tests
};
